﻿using System;
using System.Collections.Generic;
using Character;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x020001F8 RID: 504
public class HairCustomEdit : MonoBehaviour
{
	// Token: 0x06000DA8 RID: 3496 RVA: 0x00053CCC File Offset: 0x00051ECC
	public void Setup(Human human, EditEquipShow equipShow)
	{
		this.human = human;
		this.equipShow = equipShow;
		this.SetupPreset();
		string text = (human.sex != SEX.MALE) ? "ｾｯﾄ髪" : "髪型";
		this.toggles[0].SetText(text, text);
		for (HairCustomEdit.PART part = HairCustomEdit.PART.SET; part <= HairCustomEdit.PART.FRONT; part++)
		{
			bool flag = true;
			if (human.sex == SEX.MALE && part != HairCustomEdit.PART.SET)
			{
				flag = false;
			}
			this.toggles[(int)part].gameObject.SetActive(flag);
			if (flag)
			{
				this.Setup_Parts(part);
			}
		}
		for (int i = 0; i < this.tabMains.Length; i++)
		{
			this.tabMains[i].gameObject.SetActive(false);
		}
		this.colorCopyToggle.action.AddListener(new UnityAction<bool>(this.OnToggleButton_ColorCopyHelper));
		this.colorCopyHelper.moveable.AddOnChange(new UnityAction<MoveableUI.STATE>(this.OnChangeColorCopyHelperMoveableState));
	}

	// Token: 0x06000DA9 RID: 3497 RVA: 0x00053DC4 File Offset: 0x00051FC4
	private void Setup_Parts(HairCustomEdit.PART part)
	{
		int part2 = (int)part;
		this.editMode.CreateLabel(this.tabMains[part2], "髪型");
		if (this.human.sex == SEX.FEMALE)
		{
			if (part == HairCustomEdit.PART.SET)
			{
				this.selects[part2] = this.editMode.CreateItemSelectUISets(this.tabMains[part2], "セット", this.editMode.thumnbs_hair_set, new UnityAction<CustomSelectSet>(this.ChangeHair_Set));
			}
			else if (part == HairCustomEdit.PART.BACK)
			{
				this.selects[part2] = this.editMode.CreateItemSelectUISets(this.tabMains[part2], "後髪", this.editMode.thumnbs_hair_back, new UnityAction<CustomSelectSet>(this.ChangeHair_Back));
			}
			else if (part == HairCustomEdit.PART.SIDE)
			{
				this.selects[part2] = this.editMode.CreateItemSelectUISets(this.tabMains[part2], "横髪", this.editMode.thumnbs_hair_side, new UnityAction<CustomSelectSet>(this.ChangeHair_Side));
			}
			else if (part == HairCustomEdit.PART.FRONT)
			{
				this.selects[part2] = this.editMode.CreateItemSelectUISets(this.tabMains[part2], "前髪", this.editMode.thumnbs_hair_front, new UnityAction<CustomSelectSet>(this.ChangeHair_Front));
			}
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			this.selects[part2] = this.editMode.CreateItemSelectUISets(this.tabMains[part2], "髪型", this.editMode.thumnbs_hair_set, new UnityAction<CustomSelectSet>(this.ChangeHair_Set));
		}
		this.labelHairColor[part2] = this.editMode.CreateLabel(this.tabMains[part2], "色");
		HairParameter hair = this.human.customParam.hair;
		if (part != HairCustomEdit.PART.SET)
		{
			int num = part2 - 1;
			this.allColorSwitch[num] = this.editMode.CreateSwitchUI(this.tabMains[part2], "髪色を統一する", this.setAllColor, new UnityAction<bool>(this.OnChangeSetAllColor));
		}
		HAIR_TYPE[] array = new HAIR_TYPE[]
		{
			HAIR_TYPE.BACK,
			HAIR_TYPE.BACK,
			HAIR_TYPE.SIDE,
			HAIR_TYPE.FRONT
		};
		int num2 = (int)array[part2];
		this.hairColorButton[part2] = this.editMode.CreateColorChangeButton(this.tabMains[part2], "髪色", hair.parts[num2].hairColor.mainColor, false, delegate(Color color)
		{
			this.OnChangeColor_Hair(part, color);
		});
		this.hairCuticleButton[part2] = this.editMode.CreateColorChangeButton(this.tabMains[part2], "ツヤ１色", hair.parts[num2].hairColor.cuticleColor, false, delegate(Color color)
		{
			this.OnChangeColor_Cuticle(part, color);
		});
		this.cuticleExpSlider[part2] = this.editMode.CreateInputSliderUI(this.tabMains[part2], "ツヤ１絞り", 0f, 100f, false, hair.parts[num2].hairColor.cuticleExp, delegate(float val)
		{
			this.OnHairCuticleExp(part, val);
		});
		this.fresnelColorButton[part2] = this.editMode.CreateColorChangeButton(this.tabMains[part2], "ツヤ２色", hair.parts[num2].hairColor.fresnelColor, false, delegate(Color color)
		{
			this.OnChangeColor_Fresnel(part, color);
		});
		this.fresnelExpSlider[part2] = this.editMode.CreateInputSliderUI(this.tabMains[part2], "ツヤ２絞り", 0f, 100f, false, hair.parts[num2].hairColor.fresnelExp, delegate(float val)
		{
			this.OnHairFresnelExp(part, val);
		});
		List<CustomSelectSet> list = new List<CustomSelectSet>();
		for (int i = 0; i < this.presetNames.Count; i++)
		{
			list.Add(new CustomSelectSet(i, this.presetNames[i], null, null, false));
		}
		this.presetSelectUIS[part2] = this.editMode.CreatePresetSelectUISets(this.tabMains[part2], "プリセット", list, delegate(CustomSelectSet set)
		{
			this.OnHairPreset(part, set);
		});
		this.labelAcceColor[part2] = this.editMode.CreateLabel(this.tabMains[part2], "アクセサリー");
		Color color3 = (hair.parts[num2].acceColor == null) ? Color.white : hair.parts[num2].acceColor.mainColor1;
		Color color2 = (hair.parts[num2].acceColor == null) ? Color.white : hair.parts[num2].acceColor.specColor1;
		float defVal = (hair.parts[num2].acceColor == null) ? 0f : hair.parts[num2].acceColor.specular1;
		float defVal2 = (hair.parts[num2].acceColor == null) ? 0f : hair.parts[num2].acceColor.smooth1;
		this.acceColorButton[part2] = this.editMode.CreateColorChangeButton(this.tabMains[part2], "アクセサリー色", color3, false, delegate(Color color)
		{
			this.OnChangeColor_Acce(part, color);
		});
		this.acceSpecularButton[part2] = this.editMode.CreateColorChangeButton(this.tabMains[part2], "ツヤ色", color2, false, delegate(Color color)
		{
			this.OnChangeColor_AcceSpec(part, color);
		});
		this.acceMetaricSlider[part2] = this.editMode.CreateInputSliderUI(this.tabMains[part2], "ツヤの強さ", 0f, 100f, false, defVal, delegate(float val)
		{
			this.OnAcceSpecular(part, val);
		});
		this.acceSmoothSlider[part2] = this.editMode.CreateInputSliderUI(this.tabMains[part2], "ツヤの質感", 0f, 100f, false, defVal2, delegate(float val)
		{
			this.OnAcceSmooth(part, val);
		});
	}

	// Token: 0x06000DAA RID: 3498 RVA: 0x00054380 File Offset: 0x00052580
	private void SetupPreset()
	{
		this.presetNames.Clear();
		this.presetColors.Clear();
		TagText tagText = new TagText();
		tagText.Load_TextAsset(this.presetText);
		for (int i = 0; i < tagText.ElementNum; i++)
		{
			TagText.Element element = tagText.Elements[i];
			if (element.Tag == "Color")
			{
				ColorParameter_Hair colorParameter_Hair = new ColorParameter_Hair();
				string item = string.Empty;
				item = TagTextUtility.Load_String(element, "name", 0);
				colorParameter_Hair.mainColor = TagTextUtility.Load_Color(element, "mainColor", 0);
				colorParameter_Hair.cuticleColor = TagTextUtility.Load_Color(element, "cuticleColor", 0);
				colorParameter_Hair.cuticleExp = TagTextUtility.Load_Float(element, "cuticleExp", 0);
				colorParameter_Hair.fresnelColor = TagTextUtility.Load_Color(element, "fresnelColor", 0);
				colorParameter_Hair.fresnelExp = TagTextUtility.Load_Float(element, "fresnelExp", 0);
				this.presetNames.Add(item);
				this.presetColors.Add(colorParameter_Hair);
			}
		}
	}

	// Token: 0x06000DAB RID: 3499 RVA: 0x0005447C File Offset: 0x0005267C
	private void OnEnable()
	{
		if (this.equipShow != null)
		{
			this.equipShow.SetAuto(EditEquipShow.WEARSHOW.ALL);
		}
		this.ChangeTab(this.nowTab);
		this.colorCopyToggle.ChangeValue(this.colorCopyHelper.gameObject.activeSelf, false);
	}

	// Token: 0x06000DAC RID: 3500 RVA: 0x000544D0 File Offset: 0x000526D0
	private void OnDisable()
	{
		this.CloseMoveableUI();
	}

	// Token: 0x06000DAD RID: 3501 RVA: 0x000544D8 File Offset: 0x000526D8
	private void Update()
	{
		int num = -1;
		for (int i = 0; i < this.toggles.Length; i++)
		{
			if (this.toggles[i].Value)
			{
				num = i;
			}
			this.tabMains[i].gameObject.SetActive(this.toggles[i].Value);
		}
		if (num != this.nowTab)
		{
			this.ChangeTab(num);
		}
	}

	// Token: 0x06000DAE RID: 3502 RVA: 0x00054548 File Offset: 0x00052748
	private void ChangeTab(int tab)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		this.nowTab = tab;
		if (this.nowTab >= 0)
		{
			if (this.nowTab > 0)
			{
				int num = this.nowTab - 1;
				if (num >= 0)
				{
					this.allColorSwitch[num].Value = this.setAllColor;
				}
			}
			HAIR_TYPE[] array = new HAIR_TYPE[]
			{
				HAIR_TYPE.BACK,
				HAIR_TYPE.BACK,
				HAIR_TYPE.SIDE,
				HAIR_TYPE.FRONT
			};
			int num2 = (int)array[this.nowTab];
			HairPartParameter hairPartParameter = this.human.customParam.hair.parts[num2];
			this.selects[this.nowTab].SetSelectedFromDataID(hairPartParameter.ID);
			this.UpdateHairColorUI(this.nowTab);
		}
		this.CloseMoveableUI();
		this.UpdateSlotDataName();
	}

	// Token: 0x06000DAF RID: 3503 RVA: 0x00054600 File Offset: 0x00052800
	private void UpdateHairColorUI(int no)
	{
		if (no < 0)
		{
			return;
		}
		HAIR_TYPE[] array = new HAIR_TYPE[]
		{
			HAIR_TYPE.BACK,
			HAIR_TYPE.BACK,
			HAIR_TYPE.SIDE,
			HAIR_TYPE.FRONT
		};
		int num = (int)array[no];
		HairPartParameter hairPartParameter = this.human.customParam.hair.parts[num];
		bool flag;
		if (no == 0)
		{
			flag = this.human.hairs.isSetHair;
		}
		else
		{
			flag = !this.human.hairs.isSetHair;
		}
		bool flag2 = flag && this.human.hairs.HasAcce(array[no]);
		this.labelHairColor[no].gameObject.SetActive(flag);
		this.hairColorButton[no].gameObject.SetActive(flag);
		this.hairCuticleButton[no].gameObject.SetActive(flag);
		this.cuticleExpSlider[no].gameObject.SetActive(flag);
		this.fresnelColorButton[no].gameObject.SetActive(flag);
		this.fresnelExpSlider[no].gameObject.SetActive(flag);
		this.presetSelectUIS[no].toggle.gameObject.SetActive(flag);
		this.hairColorButton[no].SetColor(hairPartParameter.hairColor.mainColor);
		this.hairCuticleButton[no].SetColor(hairPartParameter.hairColor.cuticleColor);
		float value = Mathf.InverseLerp(0f, 20f, hairPartParameter.hairColor.cuticleExp) * 100f;
		this.cuticleExpSlider[no].SetValue(value);
		this.fresnelColorButton[no].SetColor(hairPartParameter.hairColor.fresnelColor);
		float value2 = Mathf.InverseLerp(0f, 8f, hairPartParameter.hairColor.fresnelExp) * 100f;
		this.fresnelExpSlider[no].SetValue(value2);
		this.labelAcceColor[no].gameObject.SetActive(flag2);
		this.acceColorButton[no].gameObject.SetActive(flag2);
		this.acceSpecularButton[no].gameObject.SetActive(flag2);
		this.acceMetaricSlider[no].gameObject.SetActive(flag2);
		this.acceSmoothSlider[no].gameObject.SetActive(flag2);
		if (flag2)
		{
			this.acceColorButton[no].SetColor(hairPartParameter.acceColor.mainColor1);
			this.acceSpecularButton[no].SetColor(hairPartParameter.acceColor.specColor1);
			this.acceMetaricSlider[no].SetValue(hairPartParameter.acceColor.specular1 * 100f);
			this.acceSmoothSlider[no].SetValue(hairPartParameter.acceColor.smooth1 * 100f);
		}
	}

	// Token: 0x06000DB0 RID: 3504 RVA: 0x0005489C File Offset: 0x00052A9C
	public void ChangedColor()
	{
		this.UpdateHairColorUI(this.nowTab);
	}

	// Token: 0x06000DB1 RID: 3505 RVA: 0x000548AC File Offset: 0x00052AAC
	public void ChangeHair_Front(CustomSelectSet selData)
	{
		if (selData == null)
		{
			return;
		}
		this.human.customParam.hair.parts[1].ID = selData.id;
		this.human.customParam.hair.parts[1].acceColor = null;
		this.CheckHair(false);
		MaterialCustomData.GetHairAcce(HAIR_TYPE.FRONT, this.human.customParam.hair.parts[1]);
		this.human.ApplyHair();
		this.UpdateHairColorUI(3);
	}

	// Token: 0x06000DB2 RID: 3506 RVA: 0x00054938 File Offset: 0x00052B38
	public void ChangeHair_Side(CustomSelectSet selData)
	{
		this.human.customParam.hair.parts[2].ID = selData.id;
		this.human.customParam.hair.parts[2].acceColor = null;
		this.CheckHair(false);
		MaterialCustomData.GetHairAcce(HAIR_TYPE.SIDE, this.human.customParam.hair.parts[2]);
		this.human.ApplyHair();
		this.UpdateHairColorUI(2);
	}

	// Token: 0x06000DB3 RID: 3507 RVA: 0x000549BC File Offset: 0x00052BBC
	public void ChangeHair_Back(CustomSelectSet selData)
	{
		this.human.customParam.hair.parts[0].ID = selData.id;
		this.human.customParam.hair.parts[0].acceColor = null;
		this.CheckHair(false);
		MaterialCustomData.GetHairAcce(HAIR_TYPE.BACK, this.human.customParam.hair.parts[0]);
		this.human.ApplyHair();
		this.UpdateHairColorUI(1);
	}

	// Token: 0x06000DB4 RID: 3508 RVA: 0x00054A40 File Offset: 0x00052C40
	public void ChangeHair_Set(CustomSelectSet selData)
	{
		this.human.customParam.hair.parts[0].ID = selData.id;
		this.human.customParam.hair.parts[0].acceColor = null;
		this.CheckHair(true);
		MaterialCustomData.GetHairAcce(HAIR_TYPE.BACK, this.human.customParam.hair.parts[0]);
		this.human.ApplyHair();
		this.UpdateHairColorUI(0);
	}

	// Token: 0x06000DB5 RID: 3509 RVA: 0x00054AC4 File Offset: 0x00052CC4
	private void CheckHair(bool isSet)
	{
		if (this.human.sex == SEX.MALE)
		{
			return;
		}
		if (isSet)
		{
			this.human.customParam.hair.parts[1].ID = 0;
			this.human.customParam.hair.parts[2].ID = 0;
			this.selects[1].SetSelectedNo(-1);
			this.selects[3].SetSelectedNo(0);
			this.selects[2].SetSelectedNo(0);
		}
		else
		{
			int id = this.human.customParam.hair.parts[1].ID;
			int id2 = this.human.customParam.hair.parts[2].ID;
			int id3 = this.human.customParam.hair.parts[0].ID;
			bool isSet2 = CustomDataManager.GetHair_Back(id3).isSet;
			if (id == 0)
			{
				CustomSelectSet selectedData = this.selects[3].GetSelectedData();
				if (selectedData != null)
				{
					id = selectedData.id;
				}
			}
			if (id2 == 0)
			{
				CustomSelectSet selectedData2 = this.selects[2].GetSelectedData();
				if (selectedData2 != null)
				{
					id2 = selectedData2.id;
				}
			}
			if (isSet2)
			{
				id3 = CustomDataManager.GetHair_Back(0).id;
			}
			this.selects[0].SetSelectedNo(-1);
			this.human.customParam.hair.parts[1].ID = id;
			this.human.customParam.hair.parts[2].ID = id2;
			this.human.customParam.hair.parts[0].ID = id3;
		}
	}

	// Token: 0x06000DB6 RID: 3510 RVA: 0x00054C74 File Offset: 0x00052E74
	private void UpdateSlotDataName()
	{
		for (int i = 0; i < this.dataNameTexts.Length; i++)
		{
			this.dataNameTexts[i].gameObject.SetActive(this.nowTab == -1);
		}
		if (this.human.sex == SEX.MALE)
		{
			BackHairData hair_Male = CustomDataManager.GetHair_Male(this.human.customParam.hair.parts[0].ID);
			this.dataNameTexts[0].text = ((hair_Male == null) ? string.Empty : hair_Male.name);
			this.dataNameTexts[1].text = string.Empty;
			this.dataNameTexts[2].text = string.Empty;
			this.dataNameTexts[3].text = string.Empty;
		}
		else
		{
			BackHairData hair_Back = CustomDataManager.GetHair_Back(this.human.customParam.hair.parts[0].ID);
			HairData hair_Side = CustomDataManager.GetHair_Side(this.human.customParam.hair.parts[2].ID);
			HairData hair_Front = CustomDataManager.GetHair_Front(this.human.customParam.hair.parts[1].ID);
			this.dataNameTexts[0].text = ((hair_Back == null || !hair_Back.isSet) ? string.Empty : hair_Back.name);
			this.dataNameTexts[1].text = ((hair_Back == null || hair_Back.isSet) ? string.Empty : hair_Back.name);
			this.dataNameTexts[2].text = ((hair_Side == null) ? string.Empty : hair_Side.name);
			this.dataNameTexts[3].text = ((hair_Front == null) ? string.Empty : hair_Front.name);
			for (int j = 0; j < this.dataNameTexts.Length; j++)
			{
				if (this.dataNameTexts[j].text == "なし")
				{
					this.dataNameTexts[j].text = string.Empty;
				}
			}
		}
	}

	// Token: 0x06000DB7 RID: 3511 RVA: 0x00054EA0 File Offset: 0x000530A0
	private void OnChangeSetAllColor(bool set)
	{
		this.setAllColor = set;
	}

	// Token: 0x06000DB8 RID: 3512 RVA: 0x00054EAC File Offset: 0x000530AC
	private void OnChangeColor_Hair_All(Color color)
	{
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.mainColor = color;
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DB9 RID: 3513 RVA: 0x00054F14 File Offset: 0x00053114
	private void OnChangeColor_Hair(HairCustomEdit.PART part, Color color)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnChangeColor_Hair_All(color);
			return;
		}
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].hairColor.mainColor = color;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBA RID: 3514 RVA: 0x00054FB0 File Offset: 0x000531B0
	private void OnChangeColor_Cuticle_All(Color color)
	{
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.cuticleColor = color;
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBB RID: 3515 RVA: 0x00055018 File Offset: 0x00053218
	private void OnChangeColor_Cuticle(HairCustomEdit.PART part, Color color)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnChangeColor_Cuticle_All(color);
			return;
		}
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].hairColor.cuticleColor = color;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBC RID: 3516 RVA: 0x000550B4 File Offset: 0x000532B4
	private void OnHairCuticleExp_All(float val)
	{
		val = Mathf.Lerp(0f, 20f, val * 0.01f);
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.cuticleExp = val;
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBD RID: 3517 RVA: 0x00055134 File Offset: 0x00053334
	private void OnHairCuticleExp(HairCustomEdit.PART part, float val)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnHairCuticleExp_All(val);
			return;
		}
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		val = Mathf.Lerp(0f, 20f, val * 0.01f);
		this.human.customParam.hair.parts[(int)hair_TYPE].hairColor.cuticleExp = val;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBE RID: 3518 RVA: 0x000551E8 File Offset: 0x000533E8
	private void OnChangeColor_Fresnel_All(Color color)
	{
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.fresnelColor = color;
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DBF RID: 3519 RVA: 0x00055250 File Offset: 0x00053450
	private void OnChangeColor_Fresnel(HairCustomEdit.PART part, Color color)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnChangeColor_Fresnel_All(color);
			return;
		}
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].hairColor.fresnelColor = color;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC0 RID: 3520 RVA: 0x000552EC File Offset: 0x000534EC
	private void OnHairFresnelExp_All(float val)
	{
		val = Mathf.Lerp(0f, 8f, val * 0.01f);
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.fresnelExp = val;
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC1 RID: 3521 RVA: 0x0005536C File Offset: 0x0005356C
	private void OnHairFresnelExp(HairCustomEdit.PART part, float val)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnHairFresnelExp_All(val);
			return;
		}
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		val = Mathf.Lerp(0f, 8f, val * 0.01f);
		this.human.customParam.hair.parts[(int)hair_TYPE].hairColor.fresnelExp = val;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC2 RID: 3522 RVA: 0x00055420 File Offset: 0x00053620
	private void OnChangeColor_Acce_All(Color color)
	{
		for (int i = 0; i < this.human.customParam.hair.parts.Length; i++)
		{
			HairPartParameter hairPartParameter = this.human.customParam.hair.parts[i];
			HAIR_TYPE hairType = (HAIR_TYPE)i;
			if (hairPartParameter.acceColor != null)
			{
				hairPartParameter.acceColor.mainColor1 = color;
				MaterialCustomData.SetHairAcce(hairType, hairPartParameter);
			}
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC3 RID: 3523 RVA: 0x000554B0 File Offset: 0x000536B0
	private void OnChangeColor_Acce(HairCustomEdit.PART part, Color color)
	{
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].acceColor.mainColor1 = color;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
		MaterialCustomData.SetHairAcce(hair_TYPE, this.human.customParam.hair.parts[(int)hair_TYPE]);
	}

	// Token: 0x06000DC4 RID: 3524 RVA: 0x00055550 File Offset: 0x00053750
	private void OnChangeColor_AcceSpec_All(Color color)
	{
		for (int i = 0; i < this.human.customParam.hair.parts.Length; i++)
		{
			HairPartParameter hairPartParameter = this.human.customParam.hair.parts[i];
			HAIR_TYPE hairType = (HAIR_TYPE)i;
			if (hairPartParameter.acceColor != null)
			{
				hairPartParameter.acceColor.specColor1 = color;
				MaterialCustomData.SetHairAcce(hairType, hairPartParameter);
			}
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC5 RID: 3525 RVA: 0x000555E0 File Offset: 0x000537E0
	private void OnChangeColor_AcceSpec(HairCustomEdit.PART part, Color color)
	{
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].acceColor.specColor1 = color;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
		MaterialCustomData.SetHairAcce(hair_TYPE, this.human.customParam.hair.parts[(int)hair_TYPE]);
	}

	// Token: 0x06000DC6 RID: 3526 RVA: 0x00055680 File Offset: 0x00053880
	private void OnAcceSpecular_All(float val)
	{
		for (int i = 0; i < this.human.customParam.hair.parts.Length; i++)
		{
			HairPartParameter hairPartParameter = this.human.customParam.hair.parts[i];
			HAIR_TYPE hairType = (HAIR_TYPE)i;
			if (hairPartParameter.acceColor != null)
			{
				hairPartParameter.acceColor.specular1 = val * 0.01f;
				MaterialCustomData.SetHairAcce(hairType, hairPartParameter);
			}
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC7 RID: 3527 RVA: 0x00055714 File Offset: 0x00053914
	private void OnAcceSpecular(HairCustomEdit.PART part, float val)
	{
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].acceColor.specular1 = val * 0.01f;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
		MaterialCustomData.SetHairAcce(hair_TYPE, this.human.customParam.hair.parts[(int)hair_TYPE]);
	}

	// Token: 0x06000DC8 RID: 3528 RVA: 0x000557BC File Offset: 0x000539BC
	private void OnAcceSmooth_All(float val)
	{
		for (int i = 0; i < this.human.customParam.hair.parts.Length; i++)
		{
			HairPartParameter hairPartParameter = this.human.customParam.hair.parts[i];
			HAIR_TYPE hairType = (HAIR_TYPE)i;
			if (hairPartParameter.acceColor != null)
			{
				hairPartParameter.acceColor.smooth1 = val * 0.01f;
				MaterialCustomData.SetHairAcce(hairType, hairPartParameter);
			}
		}
		this.human.hairs.ChangeColor(this.human.customParam.hair);
	}

	// Token: 0x06000DC9 RID: 3529 RVA: 0x00055850 File Offset: 0x00053A50
	private void OnAcceSmooth(HairCustomEdit.PART part, float val)
	{
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		this.human.customParam.hair.parts[(int)hair_TYPE].acceColor.smooth1 = val * 0.01f;
		this.human.hairs.ChangeColor(this.human.customParam.hair);
		MaterialCustomData.SetHairAcce(hair_TYPE, this.human.customParam.hair.parts[(int)hair_TYPE]);
	}

	// Token: 0x06000DCA RID: 3530 RVA: 0x000558F8 File Offset: 0x00053AF8
	private void CloseMoveableUI()
	{
		for (int i = 0; i < this.selects.Length; i++)
		{
		}
	}

	// Token: 0x06000DCB RID: 3531 RVA: 0x00055920 File Offset: 0x00053B20
	private void OnToggleButton_ColorCopyHelper(bool flag)
	{
		SystemSE.SE se = (!flag) ? SystemSE.SE.CLOSE : SystemSE.SE.OPEN;
		SystemSE.Play(se);
		if (flag)
		{
			this.colorCopyHelper.moveable.Open();
		}
		else
		{
			this.colorCopyHelper.moveable.Close();
		}
	}

	// Token: 0x06000DCC RID: 3532 RVA: 0x0005596C File Offset: 0x00053B6C
	private void OnHairPreset(HairCustomEdit.PART part, CustomSelectSet set)
	{
		if (this.setAllColor || part == HairCustomEdit.PART.SET)
		{
			this.OnHairPreset_All(set);
		}
		else
		{
			this.OnHairPreset_One(part, set);
		}
	}

	// Token: 0x06000DCD RID: 3533 RVA: 0x00055994 File Offset: 0x00053B94
	private void OnHairPreset_One(HairCustomEdit.PART part, CustomSelectSet set)
	{
		if (set.id < 0)
		{
			return;
		}
		HairParameter hair = this.human.customParam.hair;
		ColorParameter_Hair colorParameter_Hair = this.presetColors[set.id];
		HAIR_TYPE hair_TYPE = HAIR_TYPE.NUM;
		if (part == HairCustomEdit.PART.BACK)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		else if (part == HairCustomEdit.PART.SIDE)
		{
			hair_TYPE = HAIR_TYPE.SIDE;
		}
		else if (part == HairCustomEdit.PART.FRONT)
		{
			hair_TYPE = HAIR_TYPE.FRONT;
		}
		else if (part == HairCustomEdit.PART.SET)
		{
			hair_TYPE = HAIR_TYPE.BACK;
		}
		ColorParameter_Hair hairColor = hair.parts[(int)hair_TYPE].hairColor;
		hairColor.mainColor = colorParameter_Hair.mainColor;
		hairColor.cuticleColor = colorParameter_Hair.cuticleColor;
		hairColor.cuticleExp = colorParameter_Hair.cuticleExp;
		hairColor.fresnelColor = colorParameter_Hair.fresnelColor;
		hairColor.fresnelExp = colorParameter_Hair.fresnelExp;
		this.human.hairs.ChangeColor(hair);
		this.UpdateHairColorUI(this.nowTab);
	}

	// Token: 0x06000DCE RID: 3534 RVA: 0x00055A6C File Offset: 0x00053C6C
	private void OnHairPreset_All(CustomSelectSet set)
	{
		if (set.id < 0)
		{
			return;
		}
		HairParameter hair = this.human.customParam.hair;
		ColorParameter_Hair colorParameter_Hair = this.presetColors[set.id];
		foreach (HairPartParameter hairPartParameter in this.human.customParam.hair.parts)
		{
			hairPartParameter.hairColor.mainColor = colorParameter_Hair.mainColor;
			hairPartParameter.hairColor.cuticleColor = colorParameter_Hair.cuticleColor;
			hairPartParameter.hairColor.cuticleExp = colorParameter_Hair.cuticleExp;
			hairPartParameter.hairColor.fresnelColor = colorParameter_Hair.fresnelColor;
			hairPartParameter.hairColor.fresnelExp = colorParameter_Hair.fresnelExp;
		}
		this.human.hairs.ChangeColor(hair);
		this.UpdateHairColorUI(this.nowTab);
	}

	// Token: 0x06000DCF RID: 3535 RVA: 0x00055B50 File Offset: 0x00053D50
	private void OnChangeColorCopyHelperMoveableState(MoveableUI.STATE state)
	{
		if (state == MoveableUI.STATE.CLOSED)
		{
			this.colorCopyToggle.ChangeValue(false, false);
		}
	}

	// Token: 0x04000E2C RID: 3628
	[SerializeField]
	private ToggleButton[] toggles = new ToggleButton[4];

	// Token: 0x04000E2D RID: 3629
	[SerializeField]
	private GameObject[] tabMains = new GameObject[4];

	// Token: 0x04000E2E RID: 3630
	[SerializeField]
	private Text[] dataNameTexts = new Text[4];

	// Token: 0x04000E2F RID: 3631
	[SerializeField]
	private ToggleButton colorCopyToggle;

	// Token: 0x04000E30 RID: 3632
	[SerializeField]
	private CharaColorCopyHelper colorCopyHelper;

	// Token: 0x04000E31 RID: 3633
	private ItemSelectUISets[] selects = new ItemSelectUISets[4];

	// Token: 0x04000E32 RID: 3634
	[SerializeField]
	private EditMode editMode;

	// Token: 0x04000E33 RID: 3635
	private EditEquipShow equipShow;

	// Token: 0x04000E34 RID: 3636
	private Human human;

	// Token: 0x04000E35 RID: 3637
	private int nowTab = -1;

	// Token: 0x04000E36 RID: 3638
	private bool setAllColor = true;

	// Token: 0x04000E37 RID: 3639
	private ColorChangeButton[] hairColorButton = new ColorChangeButton[4];

	// Token: 0x04000E38 RID: 3640
	private ColorChangeButton[] hairCuticleButton = new ColorChangeButton[4];

	// Token: 0x04000E39 RID: 3641
	private InputSliderUI[] cuticleExpSlider = new InputSliderUI[4];

	// Token: 0x04000E3A RID: 3642
	private ColorChangeButton[] fresnelColorButton = new ColorChangeButton[4];

	// Token: 0x04000E3B RID: 3643
	private InputSliderUI[] fresnelExpSlider = new InputSliderUI[4];

	// Token: 0x04000E3C RID: 3644
	private ColorChangeButton[] acceColorButton = new ColorChangeButton[4];

	// Token: 0x04000E3D RID: 3645
	private ColorChangeButton[] acceSpecularButton = new ColorChangeButton[4];

	// Token: 0x04000E3E RID: 3646
	private InputSliderUI[] acceMetaricSlider = new InputSliderUI[4];

	// Token: 0x04000E3F RID: 3647
	private InputSliderUI[] acceSmoothSlider = new InputSliderUI[4];

	// Token: 0x04000E40 RID: 3648
	private SwitchUI[] allColorSwitch = new SwitchUI[3];

	// Token: 0x04000E41 RID: 3649
	private Text[] labelHairColor = new Text[4];

	// Token: 0x04000E42 RID: 3650
	private Text[] labelAcceColor = new Text[4];

	// Token: 0x04000E43 RID: 3651
	[SerializeField]
	private TextAsset presetText;

	// Token: 0x04000E44 RID: 3652
	private List<string> presetNames = new List<string>();

	// Token: 0x04000E45 RID: 3653
	private List<ColorParameter_Hair> presetColors = new List<ColorParameter_Hair>();

	// Token: 0x04000E46 RID: 3654
	private PresetSelectUISets[] presetSelectUIS = new PresetSelectUISets[4];

	// Token: 0x020001F9 RID: 505
	private enum TAB
	{
		// Token: 0x04000E48 RID: 3656
		SET,
		// Token: 0x04000E49 RID: 3657
		BACK,
		// Token: 0x04000E4A RID: 3658
		SIDE,
		// Token: 0x04000E4B RID: 3659
		FRONT,
		// Token: 0x04000E4C RID: 3660
		NUM
	}

	// Token: 0x020001FA RID: 506
	private enum PART
	{
		// Token: 0x04000E4E RID: 3662
		SET,
		// Token: 0x04000E4F RID: 3663
		BACK,
		// Token: 0x04000E50 RID: 3664
		SIDE,
		// Token: 0x04000E51 RID: 3665
		FRONT,
		// Token: 0x04000E52 RID: 3666
		NUM
	}
}
